All Questions
Tagged with coding-standardsreadability
11 questions
13votes
6answers
5kviews
Is it bad practice create "alias" variables to not use globals or arguments with long names in a method?
Is it OK to create a variable which only purpose is to increase readability? Example: public class Example { private final HowLongCanARepositoryNameReallyBeRepository ...
3votes
2answers
253views
Explicit type and final in stream lambdas
This argument has been going on for weeks: Bot.getGuild().getMembers().stream() .filter((final Member m) -> m.getRoles().size() == 0) .filter((final Member m) -> !m.getUser()....
1vote
1answer
191views
How to write Readable Comment when we have to deal with IDs?
How to write Readable Comment when we have to deal with IDs? I will explain this with example. +---------------+-----------------+ | permission_id | permission_name | +---------------+--------------...
6votes
1answer
688views
Use `ref` merely for clarification?
I wrote a FillSomeData(ParameterData param, Result res) method, which populates res with some data (just like it says on the label). Result is a class, not a struct, so FillSomeData actually affects ...
0votes
1answer
227views
What scientific support does some coding standards have?
Let's consider the rule in python PEP8, coding standard for the linux kernel etc saying that a line of code are not allowed to be longer than N characters. To this rule there is normally a few ...
34votes
4answers
26kviews
Usage of magic strings/numbers [closed]
This is somewhat controversial topic, and I guess there is as many opinions as there are programmers. But for the sake of it, I want to know what are the common practices in business (or in your work ...
20votes
1answer
8kviews
Why Bootstrap 3 changes camelCase to dashes - is it more readable?
I'm wondering what's the reasoning behind Bootstrap's decision to change all camel case names into hyphenated names in v3.0. I searched on Google, and looked in a few books, but I can only find ...
11votes
3answers
370views
"static" as a semantic clue about statelessness?
I've recently undertaken a refactoring of a medium sized project in Java to go back and add unit tests. When I realized what a pain it was to mock singletons and statics, I finally "got" what I've ...
14votes
4answers
3kviews
Are there any actual drawbacks to self-referential method chaining?
I recently suggested a method of chaining be implemented for a certain class in a certain project so readability of the code could be improved. I got a "fluent interfaces should not be implemented ...
11votes
12answers
3kviews
Maintainability of Boolean logic - Is nesting if statements needed?
Which of these is better for maintainability? if (byteArrayVariable != null) if (byteArrayVariable .Length != 0) //Do something with byteArrayVariable OR if ((byteArrayVariable != null)...
24votes
12answers
4kviews
Are long functions acceptable if they have internal structure?
When dealing with complicated algorithms in languages with support for nested functions (such as Python and D) I often write huge functions (because the algorithm is complicated) but mitigate this by ...